package com.siss.tenancy.util;

import java.util.Date;
import java.util.List;

/**
 * <p>类名: CalculateUtils</p>
 * <p>描述:TODO</p>
 * <p>创建人: liyp</p>
 * <p>创建时间: 2019/4/8 11:30</p>
 * <p>@version 2.0  </p>
 * <p>修改内容: ......</p>
 * <p>修改说明: ......</p>
 * <p>修改时间: ......</p>
 * <p>修改人: ......</p>
 * <p>每次修改，请增加上述修改信息说明</>
 */
public class CalculateUtils {

    public static Integer calcPeriodCount(List<Date> list){
        if(list.size()<=1){
            return list.size();
        }
        int count = 1;
        int a = 0;
        Date date = null;
        for (int i = 0 ;i < list.size(); i++){
            if((i+1) == list.size()){
                break;
            }
            date = ParserDate.addOrCutYear(list.get((i+1)),1);
            a = ParserDate.differentDays(list.get(i),date);
            if(a == 0){
                count++;
            }else{
                break;
            }
        }
        return count;
    }
}
